define([],function(){
	var tpl = {};

	tpl.basicInfo = function(){
		var html = '';
		html += basicInfo();
		return html;
	}
	tpl.schemeName = function(){
		var html = '';
		html += schemeName();
		return html;
	}
	tpl.stageNavbar = function(){
		var html = '';
		html += stageNavbar();
		return html;
	}
	tpl.courseTableThead = function(){
		var html = '';
		html += courseTableThead();
		return html;
	}
	tpl.courseTableTbody = function(){
		var html = '';
		html += courseTableTbody();
		return html;
	}
	tpl.editAmount = function(){
		var html = '';
		html += editAmount();
		return html;
	}
	tpl.modifylist = function(){
		var html = '';
		html += modifylist();
		return html;
	}
	tpl.schemeList = function(){
		var html = '';
		html += schemeList();
		return html;
	}
	tpl.startCourseStartTime = function(){
		var html = '';
		html += startCourseStartTime();
		return html;
	}
	tpl.contextMenu = function(){
		var html = "";
		html += contextMenu();
		return html;
	}

	var basicInfo = function(){
		return 	'<script id="nutrition_basicInfo" type="text-html">'+
				'   <div class="clearfix user-info">'+
		        '   	<span>姓名：{{userName}}</span>'+
		        /*'       <span>门诊号：</span>'+
		        '       <span>体重：</span>'+*/
		        '       <span>年龄：{{age}}</span>'+
				'		{{if phoneNo}}<span>手机号：{{phoneNo}}<span/>{{/if}}'+
		        '   </div>'+
				'</script>';
	}
	var schemeName = function(){
		return 	'<script id="nutrition_applicationSchemeName" type="text-html">'+
				'	<div>方案名称：<span class="ptScheme-name" ptSchemeId="{{ptSchemeId}}">{{ptSchemeName}}</span></div>'+
				'	<div>方案状态：<span>{{if status=="1"}}正常{{else if status=="4"}}终止{{/if}}</span></div><br>'+
				'	<div>启用阶段：<span>{{if status=="4"}}无启用阶段{{else}}{{usedStage}}{{/if}}</span></div>'+
				'	<div>启用疗程：<span>{{if status=="4"}}无启用疗程{{else}}{{usedCourse}}{{/if}}</span></div><br>'+
				'	<div>当前阶段：<span class="curr-stage"></span></div>'+
				'	<div>当前疗程：<span class="curr-course"></span></div>'+
				'</script>';
	}
	var stageNavbar = function(){
		return 	'<script id="nutrition_stageNavbar" type="text-html">'+
				'	<div class="stages-fold">阶段概况</div>'+
	            '   <div class="stages-unfold">'+
	            '       <div class="stages-unfold-tit">'+
	            '           <span class="stages-box-close">关闭</span>'+
	            '           <span class="stages-unfold-name">阶段概况</span>'+
	            '       </div>'+
	            '       <div class="stages-unfold-con clearfix">'+
	            '           <div class="stages-list">'+
	            '               <ul>'+
	            '					{{each list as value i}}'+
	            '                   <li ptStageId="{{value.ptStageId}}" status="{{value.status}}" class="ellipsis-1">{{value.ptStageName}}</li>'+
	            '					{{/each}}'+
	            '               </ul>'+
	            '           </div>'+
	            '           <div class="course-list">'+
	            '               <ul>'+
	            '					{{each list as value i}}'+
	            '                   <li class="course-list-group">'+
	            '                       <a class="ellipsis-1" href="#">{{value.ptStageName}}</a>'+
	            '                       <ul>'+
	            '							{{each value.ptCourses as item i}}'+
	            '                           <li class="ellipsis-1" pStageId="{{item.pStageId}}" ptCourseId="{{item.ptCourseId}}" status="{{item.status}}">{{item.ptCourseName}}</li>'+
	            '							{{/each}}'+
	            '                       </ul>'+
	            '                   </li>'+
	            '					{{/each}}'+
	            '               </ul>'+
	            '           </div>'+
	            '       </div>'+
	            '   </div>'+
				'</script>';
	}
	var courseTableThead = function(){
		return 	'<script id="nutrition_applicationCourseTableThead" type="text-html">'+
				'	<tr>'+
	            '       <th rowspan="2">天数<br/>共{{totalDays}}天</th>'+
	            '       <th rowspan="2">日期</th>'+
	            '		{{each periodHeads as value i}}'+
	            '			<th colspan="{{value.foods.length}}">{{value.periodName}}<br>({{value.time}})</th>'+
	            '		{{/each}}'+
	            '       <th colspan="{{courseNutritions.length}}">营养素<br>实际摄入与计划摄入之比</th>'+
	            '       <th rowspan="2">备注</th>'+
	            '    </tr>'+
	            '    <tr>'+
	            '		{{each periodHeads as value i}}'+
	            '			{{each value.foods as item i}}'+
	            '       		<th>{{item.foodName}}{{if item.foodUnit}}({{item.foodUnit}}){{/if}}</th>'+
	            '			{{/each}}'+
	            '		{{/each}}'+
	            '		{{each courseNutritions as value i}}'+
	            '       	<th>{{value.nutrientsName}}{{if value.nutrientsUnit}}({{value.nutrientsUnit}}){{/if}}</th>'+
	            '		{{/each}}'+
            '    </tr>'+
				'</script>';
	}
	var courseTableTbody = function(){
		return 	'<script id="nutrition_applicationCourseTableTbody" type="text-html">'+
				'	{{each situations as value i}}'+
				'	<tr>'+
	            '       <td>{{value.day}}</td>'+
	            '       <td>{{value.time}}</td>'+
	            '		{{each value.foodList as item j}}'+
	            '       	<td {{if value.flag == "1" || value.flag == "2"}}class="can-modify" data-toggle="context" data="{{item.data}}" flag="{{item.flag || value.flag}}"{{/if}} situationId="{{item.situationId}}">'+
	            '           	<span class="actual-amount {{item.className}}">{{item.actualAmount}}</span>'+
	            '				{{if item.icoClassName != "fa-sort-asc"}}<span class="{{if !item.dealState}}intake-notReport{{else}}intake-plan{{/if}}"">/</span>{{/if}}'+
	            '				<span class="default-amount {{if !item.dealState}}intake-notReport{{else}}intake-plan{{/if}}">{{item.defaultAmount}}</span>'+
	            '           	<i class="fa {{item.icoClassName}} color666 f12"></i>'+
	            '       	</td>'+
	            '		{{/each}}'+
	            '		{{each value.nutrientList as item i}}'+
	            '       	<td>'+
	            '				<span class="{{if value.flag}}{{item.className}}{{else}}intake-notReport{{/if}}">{{item.actualAmount}}</span>'+
	            '				{{if item.averageAmount}}'+
	            '				<span {{if !value.flag}}class="intake-notReport"{{/if}}>/ {{item.averageAmount}}</span>'+
	            '				{{/if}}'+
	            '			</td>'+
	            '		{{/each}}'+
	            '       <td></td>'+
	            '   </tr>'+
	            '	{{/each}}'+
				'</script>';
	}
	var editAmount = function(){
		return 	'<script id="nutrition_applicationEditAmount" type="text-html">'+
				'	<form class="form-horizontal">'+
				'  		<div class="form-group">'+
				'    		<label for="editActualAmount" class="col-sm-3 control-label">饮食量</label>'+
				'    		<div class="col-sm-8">'+
				'      			<input type="text" class="form-control" id="editActualAmount" value="{{value}}" placeholder="请输入新数据">'+
				'    		</div>'+
				'  		</div>'+
				'  		<div class="form-group">'+
				'    		<div class="col-sm-offset-3 col-sm-8">'+
				'      			<div id="editActualAmountBtn" class="btn btn-primary">确认</div>'+
				'    		</div>'+
				'  		</div>'+
				'	</form>'+
				'</script>';
	}
	var modifylist = function(){
		return 	'<script id="nutrition_applicationModifylist" type="text-html">'+
				'	<div class="modify-list">'+
				'		<table class="table table-striped table-bordered table-hover">'+
				'			<thead>'+
				'				<tr>'+
				'					<th>操作</th>'+
				'					<th>修改时间</th>'+
				'					<th>修改人姓名</th>'+
				'					<th>实际饮食量</th>'+
				'					<th>计划饮食量</th>'+
				'				<tr>'+
				'			</thead>'+
				'			<tbody>'+
				'				{{each list as value i}}'+
				'				<tr>'+
				'					<td>{{value.tit}}</td>'+
				'					<td>{{value.createTime}}</td>'+
				'					<td>{{value.modifyName}}</td>'+
				'					<td>{{value.actualAmount}}</td>'+
				'					<td>{{value.defaultAmount}}</td>'+
				'				<tr>'+
				'				{{/each}}'+
				'			</tbody>'+
				'		</table>'+
				'	</div>'+
				'</script>';
	}
	var schemeList = function(){
		return 	'<script id="nutrition_applicationSchemeList" type="text-html">'+
				'	<form class="form-horizontal">'+
				'	    <div class="form-group">'+
				'	      	<label for="changeScheme" class="col-sm-3 control-label">{{title}}</label>'+
				'    		<div class="col-sm-8">'+
				'	      		<select id="selectChangeScheme" class="form-control">'+
				'					{{each list as value i}}'+
				'	        		<option value="{{value.schemeVersionId}}">{{value.versionName}}</option>'+
				'					{{/each}}'+
				'	      		</select>'+
				'    		</div>'+
				'	    </div>'+
				'  		<div class="form-group">'+
				'    		<div class="col-sm-offset-3 col-sm-8">'+
				'      			<div id="changeSchemeBtn" class="btn btn-primary">确认</div>'+
				'    		</div>'+
				'  		</div>'+
				'	</form>'+
				'</script>';
	}
	var startCourseStartTime = function(){
		return 	'<script id="nutrition_applicationStartCourseStartTime" type="text-html">'+
				'	<form class="form-horizontal">'+
				'	    <div class="form-group">'+
				'	      	<label for="changeScheme" class="col-sm-3 control-label">开始时间：</label>'+
				'    		<div class="col-sm-8">'+
				'				<input type="date" id="startDate" min="{{minDate}}" class="form-control" value="{{minDate}}">'+
				'    		</div>'+
				'	    </div>'+
				'  		<div class="form-group">'+
				'    		<div class="col-sm-offset-3 col-sm-8">'+
				'      			<div id="startCourseStartTimeBtn" class="btn btn-primary">确认</div>'+
				'    		</div>'+
				'  		</div>'+
				'	</form>'+
				'</script>';
	}
	var contextMenu = function(){
		return 	'<scprit id="nutrition_applicationContextMenu" type="text-html">'+
				'	<ul class="dropdown-menu" role="menu">'+
				'		{{if flag == "3"}}'+
				'       {{each data as value i}}'+
				'       	<li class="editActualAmount "><a tabindex="-1" href="javascript:void(0);">{{value.foodName}} <span class="pull-right color666">{{value.userAmount}}/{{value.defaultAmount}}  <span class="fa {{if value.dealState==3}}fa-circle-o{{else if value.dealState==2}}fa-dot-circle-o{{else}}intake-notReport{{/if}}"></span></span></a></li>'+
				'       {{/each}}'+
				'		{{else if flag == "1"}}'+
			    '        	<li class="editActualAmount"><a tabindex="-1" href="javascript:void(0);">编辑实际饮食量</a></li>'+
			    '       	<li class="editDefaultAmount"><a tabindex="-1" href="javascript:void(0);">编辑计划饮食量</a></li>'+
			    '      		<li class="modifylist"><a tabindex="-1" href="javascript:void(0);">数据溯源</a></li>'+
			    '       {{else}}'+
			    '       	<li class="editDefaultAmount"><a tabindex="-1" href="javascript:void(0);">编辑计划饮食量</a></li>'+
			    '       	<li class="modifylist"><a tabindex="-1" href="javascript:void(0);">数据溯源</a></li>'+
			    '		{{/if}}'+
			    '    </ul>'+
				'</scprit>';
	}

	return tpl;
});